package com.example.comitclx1.filter;

import jakarta.servlet.*;

import java.io.IOException;

public class DemoFilter implements Filter {
    /**
     * 初始化方法，web服务器启动，创建filter，只调用一次
     * @param filterConfig
     * @throws ServletException
     */
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    /**
     * 拦截到请求时，调用该方法，可调用多次
     * 放行方法filterChain.doFilter(servletRequest,servletResponse)
     * @param servletRequest
     * @param servletResponse
     * @param filterChain
     * @throws IOException
     * @throws ServletException
     */
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {

    }

    /**
     * 销毁方法，服务器关闭时调用，只调用一次
     */
    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
